// hyb_yl/userLife/pages/doctrospeack/doctrospeack.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tab: [{
        name: "医说"
      },
      {
        name: "患教"
      },
    ],
    current: 0,
    doctorspeack: []
  },
  chooseTab: function (e) {
    console.log(e)
    var index = e.currentTarget.dataset.i
    let t = this,
      i = e.target.dataset.i;
    app.util.request({
      'url': 'entry/wxapp/index.userhj',
      data: {
        openid:wx.getStorageSync('openid')
      },
      success: function (res) {
        t.setData({
          devalArr:res.data
        })
      }
    })
    t.setData({
      current: i,
      index: index
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var color = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: '#ffffff',
      backgroundColor: color,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.getYishuo()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  getYishuo() {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/index.userqydocall',
      data: {
        openid: wx.getStorageSync('openid')
      },
      success: function (result) {
        console.log(result)
        that.setData({
          doctorspeack: result.data
        })
      }
    })
  },
  // 医说详情
  speackdetail: function (e) {
    console.log(e)
    var index = e.detail.index

    var yisid = e.detail.yisid
    wx.navigateTo({
      url: '/hyb_yl/userLife/pages/zixunanlixq/zixunanlixq?yisid=' + yisid,
    })
  },
  selecthj(e){
    var that =this
    var h_id  = e.currentTarget.dataset.h_id
    var yisid = e.detail.yisid
    var h_type = e.currentTarget.dataset.h_leixing
    wx.navigateTo({
      url: '/hyb_yl/backstageLife/pages/particulars/particulars?h_id=' + h_id + '&h_type=' + h_type,
    })
  }
})